﻿<?php
session_start();
include("admin_resist_mdl.php");
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php

include("../../Modules/conn.php");

$acctype = $_GET["acctype"];
$mssv = @$_GET["mssv"];
$mscb = @$_GET["mscb"];
$msbm = @$_GET["msbm"];
$makhoa = @$_GET["makhoa"];

$mk = $_POST['txtMK1'];
$mkmh = md5($mk);

switch ($_GET["acctype"])
{
	case "sv":
		$queryChgPass = "update sinh_vien set MAT_KHAU = '$mkmh' where MSSV = '$mssv'";
		break;
	
	case "gv":
		$queryChgPass = "update giang_vien set MAT_KHAU = '$mkmh' where MSCB = '$mscb'";
		break;
	
	case "cnbm":
		$queryChgPass = "update bo_mon set MATKHAU = '$mkmh' where MSBM = '$msbm'";
		break;
	
	case "cnk":
		$queryChgPass = "update khoa set MAT_KHAU = '$mkmh' where MA_KHOA = '$makhoa'";
		break;
}

mysql_query($queryChgPass, $conn) or die(mysql_error());
mysql_close();
header("Location: ../View/admin_cpanel.php?info=chgpasssucc");
?>